﻿<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>

    <xsl:template match="/root">

		<div class="NBright_ActionHeader">
			<xsl:if test="/root/@cat=1">
			<xsl:if test="/root/item/actions/action/category='1'">
				<h1>Start</h1>
			</xsl:if>
			</xsl:if>
			<xsl:if test="/root/@cat=2">
			<xsl:if test="/root/item/actions/action/category='2'">
				<h1>Content</h1>
			</xsl:if>
			</xsl:if>
			<xsl:if test="/root/@cat=3">
			<xsl:if test="/root/item/actions/action/category='3'">
				<h1>Graphics</h1>
			</xsl:if>
			</xsl:if>
			<xsl:if test="/root/@cat=4">
			<xsl:if test="/root/item/actions/action/category='4'">
				<h1>Build</h1>
			</xsl:if>
			</xsl:if>
			<xsl:if test="/root/@cat=5">
			<xsl:if test="/root/item/actions/action/category='5'">
				<h1>Test</h1>
			</xsl:if>
			</xsl:if>
			<xsl:if test="/root/@cat=6">
			<xsl:if test="/root/item/actions/action/category='6'">
				<h1>Move Live</h1>
			</xsl:if>
			</xsl:if>
			<xsl:if test="/root/@cat=7">
			<xsl:if test="/root/item/actions/action/category='7'">
				<h1>Completion</h1>
			</xsl:if>
			</xsl:if>
			<xsl:if test="/root/@cat=8">
			<xsl:if test="/root/item/actions/action/category='8'">
			<h1>Close Down</h1>
			</xsl:if>
			</xsl:if>
    </div>
		<div class="NBright_ActionGroup">
			
            <xsl:for-each select="/root/item/actions/action">
				<xsl:if test="/root/@cat=./category">
					<div class="NBright_ActionLeftCol">
						<div>
							<xsl:attribute name="class">
								<xsl:text>NBright_ActionLeft ajaxbutton</xsl:text>
								<xsl:value-of select="./category" disable-output-escaping="yes"/>
							</xsl:attribute>
							<xsl:attribute name="cmd">
									<xsl:text>/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=updaction&amp;templ=actions.xsl&amp;itemid=</xsl:text>
									<xsl:value-of select="/root/@itemid" disable-output-escaping="yes"/>
									<xsl:text>&amp;ctltype=ACTIONS&amp;cat=</xsl:text>
									<xsl:value-of select="./category" disable-output-escaping="yes"/>
									<xsl:text>&amp;idxref=</xsl:text>
									<xsl:value-of select="./id" disable-output-escaping="yes"/>
								<xsl:text>&amp;flag=</xsl:text>
								<xsl:value-of select="./done" disable-output-escaping="yes"/>
							</xsl:attribute>
								<xsl:if test='./done="True"'>
									<img src="/DesktopModules/NBright/NBrightEspace/img/true.png" />
								</xsl:if>
								<xsl:if test='./done!="True"'>
									<img src="/DesktopModules/NBright/NBrightEspace/img/false.png" />
								</xsl:if>
						</div>
						<div>
							<xsl:attribute name="class">
								<xsl:text>NBright_ActionLeft ajaxbutton</xsl:text>
								<xsl:value-of select="./category" disable-output-escaping="yes"/>
							</xsl:attribute>
							<xsl:attribute name="cmd">
								<xsl:text>/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=delaction&amp;templ=actions.xsl&amp;itemid=</xsl:text>
								<xsl:value-of select="/root/@itemid" disable-output-escaping="yes"/>
								<xsl:text>&amp;ctltype=ACTIONS&amp;cat=</xsl:text>
								<xsl:value-of select="./category" disable-output-escaping="yes"/>
								<xsl:text>&amp;idxref=</xsl:text>
								<xsl:value-of select="./id" disable-output-escaping="yes"/>
							</xsl:attribute>
							<img src="/DesktopModules/NBright/NBrightEspace/img/delete.png" />
						</div>
						<div class="NBright_ActionLeft tooltip ">
							<xsl:value-of select="./name" disable-output-escaping="yes"/>
							<span class="classic">
								<xsl:call-template name="break">
									<xsl:with-param name="text" select="./summary" />
								</xsl:call-template>
							</span>
						</div>
					</div>
		</xsl:if>

			</xsl:for-each>
		</div>

		<xsl:if test="/root/@cat=7">
			<div  class="NBright_ActionClear"></div>
		</xsl:if>
	
	</xsl:template>

	<xsl:template name="break">
		<xsl:param name="text" select="."/>
		<xsl:choose>
			<xsl:when test="contains($text, '&#xA;')">
				<xsl:value-of select="substring-before($text, '&#xA;')"/>
				<br/>
				<xsl:call-template name="break">
					<xsl:with-param name="text" select="substring-after($text,'&#xA;')"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$text"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
